package selum;

//导入 WebDriver 和 ChromeDriver
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class SeTest{
    public static void main(String[] args) {
        System.setProperty("webdriver.chrome.driver", "D:\\Downloads\\chromedriver_win32\\chromedriver.exe");
        ChromeOptions options = new ChromeOptions();
        //https://blog.csdn.net/qq_37059367/article/details/82942432
        // 设置禁止加载项
        Map<String, Object> prefs = new HashMap<String, Object>();
// 禁止加载js
        //prefs.put("profile.default_content_settings.javascript", 2); // 2就是代表禁止加载的意思

        options.addArguments("user-data-dir=C:/Users/Administrator/AppData/Local/Google/Chrome/User Data2");
        //options.addArguments("disable-infobars");
        //options.addArguments("headless");
        //创建 driver 对象
        WebDriver driver = new ChromeDriver(options);
        //打开项目地址
        driver.get("https://dingtalk.jiandaoyun.com/dashboard/app/5e83f50697a8780006f616a0/form/5e83f50bf4cca90006a6f930/edit#/data");
        //获取title
        String title = driver.getTitle();
        List<WebElement> tables = driver.findElements(By.tagName("table"));
        System.out.println(title);
        System.out.println(tables.size());

        //关闭浏览器
        driver.close();
    }
}